class Student {
    public String name = "小王"; //姓名
    public int age = 20; //年龄
    public String sex = "男"; //性别
    public void stu() {
        System.out.println("学习");
    }

    //构造方法
    public Student() {
        //this()
        //this("小王", 20);
        System.out.println("不带参数的构造方法");
    }
    public Student(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("带有2个参数的构造方法");
    }
}
public class Test_gz {
    public static void main(String[] args) {
        Student a = new Student();
        Student b = new Student("小王", 20);
    }
}
